package com.ymatou.iapi.userservice.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.userservice.parameter.ChangeLoginBillsRequestDtoBean;
import com.ymatou.iapi.userservice.parameter.enums.BillsActionTypeEnum;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.service.ChangeLoginBillsRequestDtoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.TestDataManager;

/**
 * 修改用户凭据Test FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_ChangeLoginBillsRequestDto {
	private static ChangeLoginBillsRequestDtoBean changeloginbillsrequestdtoBean;
	private static ChangeLoginBillsRequestDtoCall changeloginbillsrequestdtoCall;
	private static JUserWapper jUserWapper;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改用户凭据Test");
	}

	@Before
	public void caseUp() {
		changeloginbillsrequestdtoBean = new ChangeLoginBillsRequestDtoBean();
		changeloginbillsrequestdtoCall = new ChangeLoginBillsRequestDtoCall();
		jUserWapper = new JUserWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(changeloginbillsrequestdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_001() {
		Logger.start(true, "修改用户凭据,修改loginId,传入正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginId);
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNum(8));
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_002() {
		// 幂等
		Logger.start(false, "修改用户凭据,修改loginId,传入正确userid,幂等成功JIRACONN-7451");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginId);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setLoginId(cur.getLoginId());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			// Logger.verifyIsContains("登录Id已被使用",
			// changeloginbillsrequestdtoCall.getString("LastErrorMessage"),
			// "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_003() {
		Logger.start(false, "修改用户凭据,修改loginId,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginId);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNum(8));
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_004() {
		Logger.start(false, "修改用户凭据,修改loginId,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginId);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNum(8));
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_005() {
		Logger.start(true, "修改用户凭据,修改码头账号绑定登录手机,传入正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
				changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_006() {
		Logger.start(false, "修改用户凭据,修改码头账号绑定登录手机,传入正确userid,与自己手机号码重复,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMobile(cur.getMobile());
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("Success", changeloginbillsrequestdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_027() {
		Logger.start(false, "修改用户凭据,修改码头账号绑定登录手机,传入正确userid,与别人手机号码重复,失败");
		try {
			Userinfo userinfo = jUserWapper.selectTop1Userinfo();
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);

			Logger.comment("userinfo.getLoginMobile:" + userinfo.getLoginMobile());
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMobile(userinfo.getLoginMobile());
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("3", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("MobileAlreadyExists", changeloginbillsrequestdtoCall.getString("Result"), "验证LastErrorMessage");
			Logger.verifyIsContains("手机号", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_007() {
		Logger.start(false, "修改用户凭据,修改码头账号绑定登录手机,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_008() {
		Logger.start(false, "修改用户凭据,修改码头账号绑定登录手机,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_009() {
		Logger.start(true, "修改用户凭据,修改登录手机,传入正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginMobile);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_010() {
		Logger.start(false, "修改用户凭据,修改登录手机,传入正确userid,重复的手机号码,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMobile(cur.getMobile());
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("Success", changeloginbillsrequestdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_028() {
		Logger.start(false, "修改用户凭据,修改登录手机,传入正确userid,与别人手机号码重复,失败");
		try {
			Userinfo userinfo = jUserWapper.selectTop1Userinfo();
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);

			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoBean.setMobile(userinfo.getLoginMobile());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("3", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("MobileAlreadyExists", changeloginbillsrequestdtoCall.getString("Result"), "验证LastErrorMessage");
			Logger.verifyIsContains("手机号", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_011() {
		Logger.start(false, "修改用户凭据,修改登录手机,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginMobile);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_012() {
		Logger.start(false, "修改用户凭据,修改登录手机,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginMobile);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_013() {
		Logger.start(true, "修改用户凭据,修改第三方账号绑定登录手机,传入正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ThirdPartyBindMobile);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
				changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_014() {
		Logger.start(false, "修改用户凭据,修改第三方账号绑定登录手机,传入正确userid,重复的手机号码,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ThirdPartyBindMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMobile(cur.getMobile());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("true", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("Success", changeloginbillsrequestdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_029() {
		Logger.start(false, "修改用户凭据,修改第三方账号绑定登录手机,传入正确userid,与别人手机号码重复,失败");
		try {
			Userinfo userinfo = jUserWapper.selectTop1Userinfo();
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);

			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ThirdPartyBindMobile);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoBean.setMobile(userinfo.getLoginMobile());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("3", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("MobileAlreadyExists", changeloginbillsrequestdtoCall.getString("Result"), "验证LastErrorMessage");
			Logger.verifyIsContains("手机号", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_015() {
		Logger.start(false, "修改用户凭据,修改第三方账号绑定登录手机,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ThirdPartyBindMobile);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_016() {
		Logger.start(false, "修改用户凭据,修改第三方账号绑定登录手机,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ThirdPartyBindMobile);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_017() {
		Logger.start(true, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,传入非第三方的请求来源,不忽略校验密码,正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
				changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_026() {
		Logger.start(true, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,传入非第三方的请求来源,忽略校验密码,正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setLoginPassword("_NULLYMATOU_");
				changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_021() {
		Logger.start(true, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,传入第三方的请求来源,正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				// changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
				changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
				changeloginbillsrequestdtoBean.setActionSource(3);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_018() {
		Logger.start(false, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,传入正确userid,重复的收货地址邮箱,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setLoginPassword(cur.getLoginPassword());
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMail(cur.getMail());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("1", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("邮箱地址已存在", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_019() {
		Logger.start(false, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_020() {
		Logger.start(false, "修改用户凭据,修改收货地址邮箱绑定到登录邮箱,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindToLoginMail);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_022() {
		Logger.start(true, "修改用户凭据,修改激活邮箱,正确userid,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			// List<Userinfo> userinfoList =
			// jUserWapper.selectUserinfoByUid(uid);
			// Userinfo userinfo = new Userinfo();
			// if (userinfoList.size() > 0) {
			// userinfo = userinfoList.get(0);
			// Logger.verifyEquals(true,
			// userinfo.getIsActivateEmail(),"验证邮件未激活");
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ActivateEmail);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMail(cur.getMail());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyOk();
			Thread.sleep(1000);
			Logger.verifyEquals(true, jUserWapper.selectUserinfoByUid(uid).get(0).getIsActivateEmail(), "验证邮件激活成功");
			// } else {
			// Logger.verifyEquals(false, true, "验证新创建用户失败");
			// }
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_023() {
		Logger.start(false, "修改用户凭据,修改激活邮箱,传入正确userid,重复的收货地址邮箱,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);

			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ActivateEmail);
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoBean.setUserId(uid);
			changeloginbillsrequestdtoBean.setMail(cur.getMail());
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyOk();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_024() {
		Logger.start(false, "修改用户凭据,修改激活邮箱,传入不存在userid,失败");
		try {
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ActivateEmail);
			changeloginbillsrequestdtoBean.setUserId(999999999);
			changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_025() {
		Logger.start(false, "修改用户凭据,修改激活邮箱,不传入userid,失败");
		try {
			changeloginbillsrequestdtoBean.setUserId(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ActivateEmail);
			changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			VerifyNotUser();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_030() {
		Logger.start(true, "修改用户凭据,重复修改loginId,失败");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ModifyLoginId);
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNum(8));
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				changeloginbillsrequestdtoBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNum(8));
				changeloginbillsrequestdtoCall.callService();
				Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
				Logger.verifyEquals("28", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
				Logger.verifyIsContains("登录ID修改超过限制", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	// _NULLYMATOU_
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_031() {
		Logger.start(true, "修改用户凭据,修改码头账号绑定登录手机,传入正确userid,密码_NULLYMATOU_,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			if (userinfoList.size() > 0) {
				userinfo = userinfoList.get(0);
				changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.BindMobile);
				changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
				changeloginbillsrequestdtoBean.setMobile(TestDataManager.getPhoneNum());
				changeloginbillsrequestdtoBean.setLoginPassword("_NULLYMATOU_");
				changeloginbillsrequestdtoBean.setActionSource(1);
				changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
				changeloginbillsrequestdtoCall.callService();
				VerifyOk();
			} else {
				Logger.verifyEquals(false, true, "验证新创建用户失败");
			}
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_ChangeLoginBillsRequestDto_032() {
		Logger.start(false, "激活邮箱邮箱未设置,失败JIRACONN-7956");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			cur.setMail(null);
			Integer uid = JUserCallService.createUserCall(cur);
			List<Userinfo> userinfoList = jUserWapper.selectUserinfoByUid(uid);
			Userinfo userinfo = new Userinfo();
			userinfo = userinfoList.get(0);
			changeloginbillsrequestdtoBean.setAction(BillsActionTypeEnum.ActivateEmail);
			changeloginbillsrequestdtoBean.setUserId(userinfo.getUserId());
			changeloginbillsrequestdtoBean.setMail(TestDataManager.getEmail());
			changeloginbillsrequestdtoBean.setActionSource(1);
			changeloginbillsrequestdtoCall.setData(changeloginbillsrequestdtoBean);
			changeloginbillsrequestdtoCall.callService();
			Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("23", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("邮箱未设置", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyIsContains("SystemError", changeloginbillsrequestdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	/**
	 * 返回成功断言
	 */
	private void VerifyOk() {
		Logger.verifyEquals("true", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
		Logger.verifyEquals("200", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
	}

	private void VerifyNotUser() {
		Logger.verifyEquals("false", changeloginbillsrequestdtoCall.getString("Success"), "验证Success");
		Logger.verifyEquals("21", changeloginbillsrequestdtoCall.getString("ResponseCode"), "验证ResponseCode");
		Logger.verifyIsContains("用户不存在", changeloginbillsrequestdtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		Logger.verifyIsContains("UserNotFind", changeloginbillsrequestdtoCall.getString("Result"), "验证Result");
	}
}